<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>我的获赞</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/member.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <header class="header header-shadow">
        <div class="header-left">
            <div tapmode onclick="comeBack();" class="nav-left"><img class="icon-back" src="../../icon/icon-back.png"/>
            </div>
        </div>
        <h2>我的获赞</h2>
    </header>
</div>

<div class="mescroll" id="mescroll" style="padding-top: 1.5rem">
    <section class="html_section pr30 pl30 ">
        <ul class="userType_list3">
            <li class="on" tapmode data-id="1">帖子</li>
            <li tapmode data-id="2">评论</li>
        </ul>
        <div class="page_box on" data-page="1" data-ifpage='true' data-ready='false'>
            <div class="person-comment">
                <ul class="pt20"></ul>
            </div>
            <div class="nodata"></div>
        </div>
        <div class="page_box" data-page="1" data-ifpage='true' data-ready='false'>
            <div class="person-comment">
                <ul class="pt20">
                    <!-- li class="list-li" onclick="commonUrl()" tapmode>
		                    <div class="common-user-detail">
		                        <div class="user-info">
		                            <div class="user-icon bg-cover" style="background-image: url('../../image/img-tx.png');"></div>
		                            <div class="info">
		                                <div class="name">
		                                    <h6>后来熟悉</h6>
		                                    <dl class="badge-list">
		                                        <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
		                                    </dl>
		                                </div>
		                                <span class="time">1小时前</span>
		                            </div>
		                        </div>
		                        <div class="follow" tapmode onclick="follow(this)">
		                            <span class="no-follow">关注</span>
		                            <span class="followed">已关注</span>
		                        </div>
		                    </div>
		                    <div class="comment-detail multiline-ellipsis_3">
		                        <p>厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！</p>
		                    </div>
		                    <div class="invitation-div" tapmode onclick="commonUrl()">
		                        <div class="invite-icon bg-cover" style="background: url('../../image/img01.png')"></div>
		                        <div class="invite-info">
		                            <h6 class="single-ellipsis"><span>帖子</span>跟着音乐一起嗨！</h6>
		                            <p>来自音乐圈</p>
		                        </div>
		                    </div>
		                </li>
		                <li class="list-li" onclick="commonUrl()" tapmode>
		                    <div class="common-user-detail">
		                        <div class="user-info">
		                            <div class="user-icon bg-cover" style="background-image: url('../../image/img-tx.png');"></div>
		                            <div class="info">
		                                <div class="name">
		                                    <h6>后来熟悉</h6>
		                                    <dl class="badge-list">
		                                        <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
		                                    </dl>
		                                </div>
		                                <span class="time">1小时前</span>
		                            </div>
		                        </div>
		                        <div class="follow" tapmode onclick="follow(this)">
		                            <span class="no-follow">关注</span>
		                            <span class="followed">已关注</span>
		                        </div>
		                    </div>
		                    <div class="comment-detail multiline-ellipsis_3">
		                        <p>厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！</p>
		                    </div>
		                    <div class="invitation-div" tapmode onclick="commonUrl()">
		                        <div class="invite-icon bg-cover" style="background: url('../../image/img01.png')"></div>
		                        <div class="invite-info">
		                            <h6 class="single-ellipsis"><span>帖子</span>跟着音乐一起嗨！</h6>
		                            <p>来自音乐圈</p>
		                        </div>
		                    </div>
		                </li>
		                <li class="list-li" onclick="commonUrl()" tapmode>
		                    <div class="common-user-detail">
		                        <div class="user-info">
		                            <div class="user-icon bg-cover" style="background-image: url('../../image/img-tx.png');"></div>
		                            <div class="info">
		                                <div class="name">
		                                    <h6>后来熟悉</h6>
		                                    <dl class="badge-list">
		                                        <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
		                                        <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
		                                    </dl>
		                                </div>
		                                <span class="time">1小时前</span>
		                            </div>
		                        </div>
		                        <div class="follow" tapmode onclick="follow(this)">
		                            <span class="no-follow">关注</span>
		                            <span class="followed">已关注</span>
		                        </div>
		                    </div>
		                    <div class="comment-detail multiline-ellipsis_3">
		                        <p>厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！厉害了，我的哥！</p>
		                    </div>
		                    <div class="invitation-div" tapmode onclick="commonUrl()">
		                        <div class="invite-icon bg-cover" style="background: url('../../image/img01.png')"></div>
		                        <div class="invite-info">
		                            <h6 class="single-ellipsis"><span>帖子</span>跟着音乐一起嗨！</h6>
		                            <p>来自音乐圈</p>
		                        </div>
		                    </div>
		                </li> -->
                </ul>
            </div>
        </div>
    </section>

</div>

</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/mescroll.min.css"/>
<script type="text/javascript" src="../../script/mescroll.min.js"></script>
<script type="text/javascript">
    var type = 1;
    var uid = 0;
    apiready = function () {
        setFixStatusBar(); //设置状态栏
        pop.loading();
        keybackListener()
        //上拉加载
        pullUpLoading(function () {
            var ifpage = $(".page.on").data("ifpage");
            if (ifpage == true) {
                var page = Number($(".page.on").data("page"));
                page++;
                $(".page.on").data("page", page);
                ready();
            }
        });

        var param = api.pageParam;
        if(param.member_id){
            uid = param.member_id;
            $("#header h2").html('他的获赞');
        }
        ready();
    }

    //创建MeScroll对象
    var mescroll = new MeScroll("mescroll", {
        down: {
            auto: false, //是否在初始化完毕之后自动执行下拉回调callback; 默认true
            callback: downCallback //下拉刷新的回调
        }
    });
    /*下拉刷新的回调 */
    function downCallback() {
        $(".page_box.on").data('page', 1);
        $(".page_box.on").data('ifpage', true);
        ready();

        //mescroll.endErr();
    }


    function ready() {
        page = $(".page_box.on").data("page");
        var p = {token: $api.getStorage('token'), page: page, type: type};
        if(uid!=0){
            p.uid = uid;
        }
        getAjax(Interface.get_fabulous,p , function (res) {
            $(".page_box.on").data('ready', true);
            pop.close();
            var list = res.data.list;
            var html = '';
            $.each(list, function (i, item) {
                html += GetLikeList(item,type);
            })
            pop.close();
            if (page == 1)
                $(".page_box.on ul").html(html);
            else
                $(".page_box.on ul").append(html);
            if (list.length < res.data.sumpage) {
                $(".page_box.on").data('ifpage', false);
                $(".page_box.on .nodata").show();
            } else {
                $(".page_box.on .nodata").hide();
            }
            if (list.length == 0) {
                if (page == 1) {
                    $(".page_box.on .nodata").hide();
                    $(".page_box.on ul").html(noData);
                }
            }
            mescroll.endErr()
        }, function (res, err) {
            mescroll.endErr()
        })
    }

    $(".userType_list3 li").click(function () {
        $(".userType_list3 li").removeClass("on");
        $(this).addClass("on");
        $(".page_box").removeClass("on");
        $(".page_box").eq($(this).index()).addClass("on");
        type = $(this).data("id");
        var ifr = $(".page_box.on").data('ready');
        if (ifr == false) {
            ready();
        }
    })


    //评论
    function GetLikeList(item, type) {
        var html = '';
        if (!isDefine(item)) {
            return true;
        }
        console.log(jsonChange(item));
        var userInfo = $api.getStorage('userInfo');
        var userData = item.member;
        console.log();
        var badgeList = '';//徽章列表
        if (isDefine(userData.badge_path)) {
            for (var k = 0; k < userData.badge_path.length; k++) {
                if (k <= 5) {
                    badgeList += '<dd class="icon"><img src="' + getImg(userData.badge_path[k]) + '" alt=""></dd>'
                }
            }
        }
        var userVip = '';
        if(isDefine(userData.attestation_status)){
            if(userData.attestation_status == 2){
                userVip = '<span class="vip"></span>';
            }
        }
        var member_id = {'member_id': userData.id};
        html += '<li>';
        html += '<div class="common-user-detail">';
        html += '<div class="user-info"tapmode onclick=\'commonUrl("../activity/person_index",' + jsonChange(member_id) + ')\'>';
        html += '<div class="userRelative"><div class="user-icon bg-cover" style="background-image: url(' + getImg(userData.icon_path) + ');"></div>'+userVip+'</div>';
        html += '<div class="info">';
        html += '<div class="name">';
        html += '<h6>' + userData.name + '</h6>';
        html += '<dl class="badge-list" tapmode onclick="toBadgePage(event)">';
        html += badgeList;
        html += '</dl>';
        html += '</div>';
        html += '<span class="time">' + item.date + '</span>';
        html += '</div>';
        html += '</div>';
        if (userInfo.id != userData.id) {
            if (item.member_follow) {
                html += '<div class="follow" tapmode onclick="followAction(1,' + userData.id + ')">';
                html += '<span class="followed">已关注</span>';
                html += '</div>';
            } else {
                html += '<div class="follow" tapmode onclick="followAction(2,' + userData.id + ')">';
                html += '<span class="no-follow">关注</span>';
                html += '</div>';
            }
        }
        html += '</div>';
        var pl = item.list;
        
        if (type == 2) {
            html += '<div class="comment-detail multiline-ellipsis_3" style="-webkit-line-clamp: initial;" onclick=\'commonUrl("../activity/person_index",' + jsonChange(member_id) + ')\'>';
            html += '<p>' + pl.comment + '</p>';
            html += '</div>';
        }
        var url = '../circle/invite_detail';
        var text = '帖子';
        var invitation_id = {'invitation_id': pl.article_id};
        if(pl.type == 1){
            text='新闻';
            url = '../index/news_detail';
            invitation_id =  {'news_id': pl.article_id};
        }else if(pl.type == 3){
            text='活动';
            url = '../activity/activity_index';
            invitation_id =  {'activity_id': pl.article_id};
        }
        html += '<div class="invitation-div" tapmode  onclick=\'commonUrl("'+url+'",' + jsonChange(invitation_id) + ')\'>';
        html += '<div class="invite-icon bg-cover" style="background: url(' + getImg(pl.content_path) + ')"></div>';
        html += '<div class="invite-info">';
        html += '<h6 class="single-ellipsis"><span>'+text+'</span>' + pl.title + '</h6>';
        if(pl.circle_title){
             html += '<p>来自' + pl.circle_title + '</p>';
        }
        html += '</div>';
        html += '</div>';
        html += '<div class="c-999 flex_end f24 mt10">'+item.fabulous_date+'</div>';
        html += '</li>';
        return html;
    }


</script>
